extends cmslayout
block header
  title #{portal.seotitle}
  meta(name="keywords",content="#{portal.keywords}")
  meta(name="description",content="#{portal.description}")
block content
  .layui-container.mt-20
    if pushmovies&&pushmovies.length>0
      .card
        fieldset.layui-elem-field.layui-field-title
          legend 推荐
          .layui-field-box
            .layui-row.layui-col-space10
              each pushmovie in pushmovies
                .layui-col-md4
                  .push-box
                    .push-img
                      a(href="/movie/#{pushmovie.movieid._id}")
                        if pushmovie.movieid.poster
                          img(src="#{pushmovie.movieid.poster}")
                        else
                          img(src="/videos/#{pushmovie.movieid._id}/1.jpg")
                    a(href="/movie/#{pushmovie.movieid._id}")
                      h2.pushtitle #{pushmovie.movieid.originalname}
    .layui-row.layui-col-space10.index-lists
      each list in lists
        if list.images
          .item-width.list-item
            .card.nopadding.md0
              a(href="/image/#{list._id}")
                img.images-poster(src="/images/#{list._id}/poster.jpg")
              .card-body.index-card-body
                a(href="/image/#{list._id}")
                  h2 #{list.title}
                a.mt-15.badge.badge-warning(href="/imageslist") #{portal.imagestitle}
        if list.content
          .item-width.list-item
            .card.md0
              .card-body.index-card-body
                a(href="/article/#{list._id}") 
                  h2 #{list.title}
                - var content = list.content.replace(/<[^>]+>/g,"");
                if content.length > 60
                  - content = content.substr(0, 60) + "...";
                p.article-description #{content}
                a.mt-15.badge.badge-success(href="/articles") #{portal.articlestitle}
        if list.status
          .item-width.list-item
            .card.nopadding.md0
              a(href="/movie/#{list._id}")
                if list.poster
                  img(src="#{list.poster}")
                else
                  img(src="/videos/#{list._id}/1.jpg")
              .card-body.index-card-body
                a(href="/movie/#{list._id}")
                  h2 #{list.originalname}
                a.mt-15.badge.badge-error(href="/movies") #{portal.moviestitle}
    .text-center 浏览更多： 
      .layui-btn-group
        a.layui-btn.layui-btn-radius.layui-btn-danger(href="/movies") #{portal.moviestitle}
        if portal.images == 'on'
          a.layui-btn.layui-btn-radius.layui-btn-warning(href="/imageslist") #{portal.imagestitle}
        if portal.articles == 'on'
          a.layui-btn.layui-btn-radius.layui-btn-normal(href="/articles") #{portal.articlestitle}
append script
  script(src="/javascripts/imagesloaded.pkgd.min.js")
  script(src="/javascripts/masonry.pkgd.min.js")
  script.
    var $grid = $('.index-lists').masonry({
      // set itemSelector so .grid-sizer is not used in layout
      itemSelector: '.list-item',
      // use element for option
      columnWidth: '.item-width',
      percentPosition: true
    });
    $grid.imagesLoaded().progress(function() {
      $grid.masonry('layout');
    });